﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;


namespace QuanLyHocBongSinhVien.DAO
{
    public class MucHocBong_DAO
    {
        dbConnection db = new dbConnection();
        public DataTable getMaMHB()
        {
            string sql = "select MAMUCHB from MUCHOCBONG";
            return db.ExecuteQuery(sql);
        }
        public DataTable getAllMucHB()
        {
            return db.ExecuteQuery("select * from MUCHOCBONG");
        }

        public void themMHB(string m, string t)
        {
            SqlParameter[] mang = new SqlParameter[2];
            mang[0] = new SqlParameter("@mamuchb",m);
            mang[1] = new SqlParameter("@tenmuchb",t);
            db.ExecuteNonQuery("Them_MucHocBong", mang);
        }

        public void SuaMHB(string m, string t)
        {
            SqlParameter[] mang = new SqlParameter[2];
            mang[0] = new SqlParameter("@mamuchb", m);
            mang[1] = new SqlParameter("@tenmuchb", t);
            db.ExecuteNonQuery("Sua_MucHocBong", mang);
        }
        public void XoaMHB(string m)
        {
            SqlParameter[] mang = new SqlParameter[1];
            mang[0] = new SqlParameter("@mamuchb", m);
            db.ExecuteNonQuery("Xoa_MucHocBong", mang);
        }

        public void TimKiemMHB(string m)
        {
            SqlParameter[] mang = new SqlParameter[1];
            mang[0] = new SqlParameter("@mamuchb", m);
            db.ExecuteNonQuery("TimKiem_MucHB", mang);
        }

        public void TimKiemTenMHB(string m)
        {
            SqlParameter[] mang = new SqlParameter[1];
            mang[0] = new SqlParameter("@tenmuchb", m);
            db.ExecuteNonQuery("TimKiem_TenMucHB", mang);
        }
        
    }
}
